<!--
Author: Quan Van Sinh
Email : sinhvnb@vietnambiz.com
Mobile: 0972405165
-->
<?php include ADMIN_INCLUDE_DIR."/header.php";?>
<script type="text/javascript" language="javascript">
    function delNews(params,text){
        confirm_get("Bạn chắc chắn muốn xóa "+text+"?",'<?php echo ADMIN_URL;?>'+params);
    }

    function multiNewsAction(action){
        objForm = $("#formNewsView");
        switch (action) {
            case 'delete':
                $("#formNewsViewAction").val('delete');
                confirm_post("Bạn có chắc chắn?",'formNewsView');
                break;
            case 'setStatusYes':
                $("#formNewsViewAction").val('setStatusYes');
                objForm.submit();
                break;
            case 'setStatusNo':
                $("#formNewsViewAction").val('setStatusNo');
                objForm.submit();
                break;
        }

    }
</script>
<div class="container_l">
    <div class="title_user"><img src="images/icon4.gif" />Danh sách thư</div>
    <div class="table_user">

        <?php
        show_error();
        show_success();
        ?>
        <div class="spacer1"><span></span></div>
        <fieldset>
            <legend accesskey="N">Tìm kiếm thư</legend>
            <form name="formNewsSearch" method="get" action="">
                <div class="lineaddnew">
                    <div class="lineform">
                        <div class="divlabel">Từ khóa:</div>
                        <div class="divform">
                            <input type="hidden" name="module" value="newsletter"/>
                            <input type="text" name="keyword" value="<?php echo stripcslashes(htmlentities_utf8($_REQUEST['keyword']));?>"/>
                        </div>
                    </div>
                    <div class="linesubmit">
                        <input type="submit" name="submitFrmNewsSearch" value="Tìm kiếm" class="button" />
                    </div>
                    <div class="spacer1"><span></span></div>
                </div>
            </form>
        </fieldset>
        <div class="spacer1"><span></span></div>
        <form id="formNewsView" method="post" action="">
            <div class="table_user_in">
                <div class="boxtitle">
                    <div class="d_input">
                        <input type="checkbox" name="checkall" id="checkall" value="" />
                        <input type="hidden" id="formNewsViewAction" name="formNewsViewAction" value=""/>
                        <input type="hidden" id="action" name="action" value="multiAction"/>
                    </div>
                   <div class="d_title"  style="width:85%">Email</div>
                    
                    <div class="d_statusnews" >Trạng thái</div>
                    

                </div>
                <?php
                $rsNews = listAllNews();
                if($db->num_rows($rsNews['rs'])) {
                    while($rs=$db->fetch_array($rsNews['rs'])) {
                        ?>
                <div class="lineuser">
                    <div class="d_input2"><input type="checkbox" name="arr_news_id[]" class="check" value="<?php echo $rs['id'];?>" /></div>
                    <div class="d_title2" style="width:85%"><font class="textbody"><?php echo $rs['email'];?></font></div>
                    <div class="d_statusnews2"><font color="#FF0000"><?php if($rs['status']=='yes') {echo '<img src="images/active.gif" alt="'.$rs['email'].'" />';}else {echo $rs['status'];}?></font></div>
                </div>
                    <?php
                    }
                    ?>
                <div class="boxbutton" style="width:86%">
                    <input type="button" onclick="javascript: multiNewsAction('setStatusYes');" value="Cho phép nhận thư" class="button" />
                    <input type="button" onclick="javascript: multiNewsAction('setStatusNo');" value="Không cho phép nhận thư" class="button" />
                    <input type="button" onclick="javascript: multiNewsAction('delete');" value="Xóa mục đã chọn" class="button" />
                </div>
                    <?php paging($rsNews['page'], $rsNews['totalPages'], get_string_url());?>

                <?php }?>
            </div>
        </form>
    </div>
</div>

<?php
include "inc/right.php";
include ADMIN_INCLUDE_DIR."/footer.php";
?>